package com.zks.springbootcrud.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.zks.springbootcrud.entity.Staff;
import com.zks.springbootcrud.mapper.StaffMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class StaffServiceImp implements StaffService{

    @Resource
    StaffMapper staffMapper;


    @Override
    @DS("slaver1")
    public Staff findStaffById(int id) {

        return staffMapper.selectById(id);
    }

    @Override
    public int insertStaff(Staff staff) {
        int state=staffMapper.insert(staff);
        return state;
    }

    @Override
    public void deleteStaffById(int id) {

        staffMapper.deleteById(id);

    }

    @Override
    public void updateStaff(Staff staff) {

        staffMapper.updateById(staff);
    }
}
